<extend name="Public/base"/>
<block name="body">
    <div id="top-alert" class="fixed alert alert-error" style="display: none;">
        <button class="close fixed" style="margin-top: 4px;">×</button>
        <div class="alert-content">这是内容</div>
    </div>
    <div id="main" style="overflow-y: auto; overflow-x: hidden; min-height: 552px;">

        <!-- nav -->
        <!-- nav -->


        <div class="admin-main-container">

            <link type="text/css" rel="stylesheet" href="{:getRootUrl()}Public/js/ext/magnific/magnific-popup.css">
            <!-- 标题 -->
            <div class="main-title">
                <h2>
                    {$title}                    </h2>
            </div>

            <div style="margin-bottom: 10px;" class="hide" id="search_form">

                <style>
                    .tb_search td{
                        padding: 5px 10px;
                    }
                </style>
                <form id="searchForm" method="get" action="" class="form-dont-clear-url-param">
                    <div class="search-form  cf " style="margin-bottom: 10px">
                        <table class="tb_search">

                            <tbody><tr><td></td>
                                <td><input type="submit" class="btn" value="确定"> <button class="btn ajax-post btn" onclick="toggle_search()">关闭</button></td>
                                <td></td>
                            </tr>
                            </tbody></table>
                    </div>
                </form>
                <div style="border-top:1px solid #ccc;border-bottom: 1px solid white"></div>
            </div>
            <!-- 按钮工具栏 -->
            <div class="with-padding">
                <div class="fl">

                    <button class="btn ajax-post tox-confirm btn" data-confirm="执行此操作请先与客户协商以免引起矛盾" url="{:U('admin/Feedback/donopass',array('ids'=>$item['id']))}" target-form="ids">不通过</button>&nbsp;


                    <!-- 选择框select -->
                    <div style="float: right;">
                        <style>
                            .oneselect{
                                display: inline-block;
                                margin-left: 10px;
                            }
                            .oneselect .title{
                                float: left;
                                line-height: 32px;
                            }
                            .oneselect .select_box{
                                float: left;
                                line-height: 32px;
                            }
                            .oneselect .select_box select{
                                min-width: 200px;
                            }
                        </style>
                        <form id="selectForm" method="get" action="" class="form-dont-clear-url-param">
                        </form>
                    </div>
                </div>

            </div>


            <!-- 数据表格 -->
            <div class="with-padding">
                <table class="table table-bordered table-striped ">
                    <!-- 表头 -->
                    <thead>
                    <tr>
                        <th class="row-selected row-selected">
                            <input class="check-all" type="checkbox">
                        </th>
                        <th>ID</th><th>订单号</th><th>付款单号</th><th style="min-width:50px;">价格</th><th >描述</th><th>操作人</th><th>创建时间</th><th>更新时间</th><th>操作</th>            </tr>
                    </thead>

                    <!-- 列表 -->
                    <tbody>
                    <foreach name="data" item="item">
                        <tr>
                            <td><input class="ids" type="checkbox" value="{$item.id}" name="ids[]"></td>
                            <td>{$item.id}</td>
                            <td><a target="_blank" href="{:U('Feedback/dingdang/xq',array('orderid'=>$item['orderid']),true,true)}">{$item['orderid']}</a></td>
                            <td><div  style="max-width:180px;">{$item.payid}</div></td>
                            <td>{$item.price}元</td>
                            <td><div  style="max-width:200px;">{$item.description}</div></td>
                            <td>{:getUserLink($item['uid'])}</td>
                            <td>{:dateformat($item['create_time'])}</td>
                            <td>{:dateformat($item['update_time'])}</td>
                            <td>
                                <a onclick="return confirm('您确实要退款吗？（此操作将钱返还给客户）','提示')" href="{:U('admin/Feedback/dopass',array('ids'=>$item['id']))}">通过</a>
                                <a onclick="return confirm('执行此操作请与客户协商以免引起矛盾。','提示')" href="{:U('admin/Feedback/donopass',array('ids'=>$item['id']))}">不通过</a>
                            </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
            </div>
            <!-- 分页 -->
            <div class="with-padding">
                {$page}
            </div>

            <script type="text/javascript" src="{:getRootUrl()}Public/static/thinkbox/jquery.thinkbox.js"></script>
            <script type="text/javascript">
                //        //搜索功能
                //        $("#search").click(function () {
                //            var url = $(this).attr('url');
                //            var query = $('.search-form').find('input').serialize();
                //            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                //            query = query.replace(/^&/g, '');
                //            if (url.indexOf('?') > 0) {
                //                url += '&' + query;
                //            } else {
                //                url += '?' + query;
                //            }
                //            window.location.href = url;
                //        });
                //回车搜索
                //        $(".search-input").keyup(function (e) {
                //            if (e.keyCode === 13) {
                //                $("#search").click();
                //                return false;
                //            }
                //        });
                function toggle_search(){
                    $('#search_form').toggle('slide');
                }

                $(document).on('submit', '.form-dont-clear-url-param', function(e){
                    e.preventDefault();

                    var seperator = "&";
                    var form = $(this).serialize();
                    var action = $(this).attr('action');
                    if(action == ''){
                        action = location.href;
                    }
                    var new_location = action + seperator + form;
                    location.href = new_location;

                    return false;
                });


            </script>


            <script>
                $(function(){
                    $('[data-role="select_text"]').change(function(){
                        $('#selectForm').submit();
                    });
                    //模态弹窗
                    $('[data-role="modal_popup"]').click(function(){
                        var target_url=$(this).attr('modal-url');
                        var data_title=$(this).attr('data-title');
                        var target_form=$(this).attr('target-form');
                        if(target_form!=undefined){
                            //设置了参数时，把参数加入
                            var form=$('.'+target_form);

                            if (form.get(0) == undefined) {
                                updateAlert('没有可操作数据。','danger');
                                return false;
                            } else if (form.get(0).nodeName == 'FORM') {
                                query = form.serialize();
                            } else if (form.get(0).nodeName == 'INPUT' || form.get(0).nodeName == 'SELECT' || form.get(0).nodeName == 'TEXTAREA') {
                                query = form.serialize();
                            } else {
                                query = form.find('input,select,textarea').serialize();
                            }
                            if(!query.length){
                                updateAlert('没有可操作数据。','danger');
                                return false;
                            }
                            target_url=target_url+'&'+query;
                        }
                        var myModalTrigger = new ModalTrigger({
                            'type':'ajax',
                            'url':target_url,
                            'title':data_title
                        });
                        myModalTrigger.show();
                    });
                    $('.tox-confirm').click(function(e){
                        var text = $(this).attr('data-confirm');
                        var result = confirm(text);
                        if(result) {
                            return true;
                        } else {
                            e.stopImmediatePropagation();
                            e.stopPropagation();
                            e.preventDefault();
                            return false;
                        }
                    })
                });


                $(document).ready(function () {
                    $('.popup-gallery').each(function () { // the containers for all your galleries
                        $(this).magnificPopup({
                            delegate: 'a',
                            type: 'image',
                            tLoading: '正在载入 #%curr%...',
                            mainClass: 'mfp-img-mobile',
                            gallery: {
                                enabled: true,
                                navigateByImgClick: true,
                                preload: [0, 1] // Will preload 0 - before current, and 1 after the current image

                            },
                            image: {
                                tError: '<a href="%url%">图片 #%curr%</a> 无法被载入.',
                                titleSrc: function (item) {
                                    /*           return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';*/
                                    return '';
                                },
                                verticalFit: false
                            }
                        });
                    });
                });
            </script>
            <script type="text/javascript" src="{:getRootUrl()}Public/js/ext/magnific/jquery.magnific-popup.min.js"></script>

        </div>


</block>